POV-Ray : Newsgroups : povray.general : POV-CSDL (or Java Binding?) : Re: POV-CSDL (or Java Binding?) Server Time
10 Aug 2024 13:21:47 EDT (-0400)
  Re: POV-CSDL (or Java Binding?)  
From: Johannes Hubert
Date: 12 Mar 2000 18:53:00
Message: <38cc2ddc$1@news.povray.org>
"Chris Huff" <chr### [at] yahoocom> wrote in message
news:chrishuff_99->

> Hmm. The first problem: I am writing this in C++, POV is written in C.

Blending C++ and C is not too hard...

> The second one: I don't know enough about the parser to attempt
anything
> like this.

No, what I mean is this: Don't interfere with the POV-parser at all,
just at the very first function call, where the POV-parser is initially
called:
Here, insert a call to your own parser code which pre-translates the
code it reads from the input file *before* passing it to the standard
POV-parser.
For this, you can leave the POV-parser totally alone.
This is also why I mean that blending C and C++ isn't too hard: Between
your code and the rest of the POV code there would be only one single
function call to a global function in your module, which is passed the
current script as a parameter, and which returns the same script, but
with all CSDL blocks replaced by their POV equivalents.

> And of course, as you mentioned, parsing would be slower, even slower
> than ordinary POV code. One of the biggest advantages of a separate
> translator would be that the translator program could be significantly
> faster than the POV-Script parser, and could output code that would
> parse faster than it's human-written POV-Script equivalent(it could do
> this by unrolling loops, etc).

All this can still happen. Meaning: Your "preparser" can still be faster
than the POV-parser (if you achieve that), and the code it outputs can
still be faster for POV to parse than human written (and readable) code
(for the same objects) would be.
It is slower only because the CSDL code has to be parsed each time you
run the script through the patched POV. If using a separate tool, then
the CSDL code is parsed and translated only once, when you run the tool,
and is then saved into a POV-INC file which can be used many times by an
unpatched POV without the need to CSDL-parse it again (of course it
would still go through the standard POV parse).
If the CSDL parser was integrated into POV (as a step before the
standard parser) it would need to CSDL-parse the script each time - this
is the disadvantage I meant.

Probably the best step is to do a separate tool like you are planning
now, and see how it gets accepted. If people like it, integrating it
into a POV patch (the mega-patch?) would be a great idea, I think.

> I am working on a definition of a possible syntax, I will probably
> eventually post it in povray.off-topic to keep from wasting server
> space(because there will probably be several revisions).

This is an interesting project. I would be happy to offer any help I can
give (both in the language design and/or programming).

Greetings,
Johannes.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.